package com.qf.controller;

import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

/**
 * projectName: Spring
 *
 * @author: MaTianWei
 * time: 2021/6/29 9:00
 * description:
 */
@Controller
public class UserController {

    @Autowired  //回去Spring容器中找到一个类型为Service的对象，找到一个，直接从注入，找到0个直接报错
    @Qualifier(value = "userService1")  //如果@Autowired注入的实例在容器中有多个，配合@Qualifier指定唯一标识
    private UserService userService;

    public String findById(Integer id){
        return userService.findById(id);
    }
}
